package com.classs05.a_exception;

import javax.xml.transform.Source;

public class Demo09Exception {
    public static void main(String[] args) {
        int method = method();
        System.out.println(method);
    }

    public static int method() {
        try {
            String s = null;
//        NullPointerException
            System.out.println(s.length());//空指针异常
            return 2;
        } catch (NullPointerException e) {
            return 1; //return 1代表的是将1返回，结束方法
        } finally {
            System.out.println("一定会执行到");
            return 3;
        }

    }
}
